<style>
    .pay-success .pay-content img.close {
        position: absolute;
        width: 20px;
        height: 20px;
        top: 10px;
        right: 10px;
        cursor: pointer;
    }

    .pay-success {
        width: 140vw;
        height: 140vh;
        position: fixed;
        z-index: 1001111101;
        left: -20vw;
        top: -20vh;
        background: rgba(0, 0, 0, .6);
    }

    .pay-success, .pay-success .pay-content {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }

    .pay-success .pay-content {
        width: 500px;
        height: 300px;
        background: #fff;
        border-radius: 4px;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        position: relative;
    }

    .typehbox {
        display: flex;
        width: 507px;
        height: 120px;
    }

    .typehbox .tbox {
        align-items: center;
        justify-content: center;
        height: 50px;

        min-width: 100px;
        width: auto;
        text-align: center;
        line-height: 50px;
        margin-left: 10px;
        border: solid 1px #a9a9e3;
        margin-top: 40px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 6px;
        background: #c7e9fd;
        cursor: pointer;
        padding: 0px 5px;

    }

    .typehbox .tbox:hover {
        color: white;
        background: #308fc7;
    }

    .typehbox .tbox:first-child {
        margin-left: 45px;
    }

    .showpicbox {

    }

    .gaotext {
        color: red;
        width: 200px;
        margin-left: 10px;
        float: left;
    }

    .dsrtext {
        display: none;
        color: red;
        width: 80%;
        margin-left: 10px;
        float: left;
        height: auto;
    }

    .btn-select {
        position: relative;
        display: inline-block;
        width: 150px;
        height: 25px;
        background-color: #f80;
        font: 14px/20px "Microsoft YaHei";
        color: #fff;
    }

    .btn-select .cur-select {
        position: absolute;
        display: block;
        width: 150px;
        height: 25px;
        line-height: 25px;
        background: #f80 url(ico-arrow.png) no-repeat 125px center;
        text-indent: 10px;
    }

    .btn-select:hover .cur-select {
        background-color: #f90;
    }

    .btn-select select {
        position: absolute;
        top: 0;
        left: 0;
        width: 150px;
        height: 25px;
        opacity: 0;
        filter: alpha(opacity:0;
    );
        font: 14px/20px "Microsoft YaHei";
        color: #f80;
    }

    .btn-select select option {
        text-indent: 10px;
    }

    .btn-select select option:hover {
        background-color: #f80;
        color: #fff;
    }

    .zuo2 {
        width: 10%;
        min-width: 120px;
        margin-right: 1%;
        float: left;
        line-height: 33px;
    }
</style>

<div class="fbneirong">
    <form class="am-form jdtask">

        <div style=" position: absolute;  left: 85%; height: 188px; width: 400px; top: 200px;">
            <div style="float: left;width: 100%">放任务请咨询客服</div>
            <img style="float: left;width: 200px;height: 160px" src="<?php echo $this->session->webinfo['weixin']; ?>"
                 class="picurl">
        </div>

        <div class="am-form-group am-cf itemid">
            <div class=" dsrtext" style="margin-left: 160px">
                请必须符合下方红字要求 否则后果本平台概不负责
            </div>

            <div class="zuo">商品链接：</div>
            <div class="you" style="width: 600px">
                <input type="text" class="myinput am-input-sm " name="link" style="width: 600px;" placeholder="请输入链接">
                <!--  <span id="updata" class="am-btn am-btn-secondary am-radius">访问</>-->
            </div>
            <div class=" gaotext">
                高留评操作商品必须开通批发
            </div>
            <div class=" dsrtext">
                设置流程：请开通多多进宝，设置单品通用推广，佣金设置最低即可，优惠券设置最低，然后放单复制多多进宝短链接。任务需要填写关键词，做单
            </div>
            <div class=" dsrtext" style="margin-left: 176px">
                当天不可刷任何补单业务 ，必须当天发一单真实快递，可以合并发货！！效果：出评增加商品DSR评分，增加搜索指数，可以上升搜索排名！！
            </div>
        </div>


        <div class="am-form-group am-cf">
            <div class="zuo">商品名称：</div>
            <div class="you">
                <input type="text" name="goods_name" class="myinput am-input-sm" id="doc-ipt-email-1"
                       style="width: 500px;" placeholder="请输入商品名称">
            </div>
        </div>

        <div class="am-form-group am-cf">
            <div class="zuo">店铺名称：</div>
            <div class="you">
                <input type="text" name="shop_name" class="myinput am-input-sm shop_name" id="doc-ipt-email-1"
                       style="width: 500px;" placeholder="请输入店铺名称">


                <!--     <select class="myinput shop_name" style="width: 330px;border-radius: 5px;">
                    <?php /*foreach ($shoplist as $id => $v) { */ ?>
                        <option><?php /*echo $v['name'] */ ?></option>
                    <?php /*} */ ?>
                </select>-->

            </div>


        </div>

        <div class="am-form-group am-cf">
            <div class="zuo">页面显示价：</div>
            <div class="zuo">
                <input type="text" name="price" class="myinput am-input-sm" id="doc-ipt-email-1" placeholder="请输入客单价">
            </div>

            <div class="zuo" style="width: 110px">实际付款价格：</div>
            <div class="zuo">
                <input type="text" name="pay_price" class="myinput am-input-sm" id="doc-ipt-email-1"
                       placeholder="请输入付款价格">
            </div>
            <div class="zuo" style="width: 90px">订单类型：</div>
            <div class="zuo" style="margin-left: -30px;width: 410px;color: #0c7edf">
                <label class="am-radio-inline">
                    <input type="radio" value="1" name="type_h">普通单
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="2" name="type_h"> 高留评
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="3" name="type_h">搜索指数+DSR单
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="4" name="type_h"> 拼多多直播
                </label>
            </div>

        </div>

        <div class="am-form-group am-cf">

            <!--           <div class="zuo">开团价格：</div>
                       <div class="zuo">
                           <input type="text" name="single_price" class="myinput am-input-sm" id="doc-ipt-email-1"
                                  placeholder="请输入开团价格">
                       </div>

                       <div class="zuo">拼团价格：</div>
                       <div class="zuo">
                           <input type="text" name="group_price" class="myinput am-input-sm" id="doc-ipt-email-1"
                                  placeholder="请输入拼团价格">
                       </div>
           -->

            <div class="zuo">搜索关键字：</div>
            <div class="zuo">
                <input type="text" name="keyword" class="myinput am-input-sm" id="doc-ipt-email-1" placeholder="请输入关键字"
                       style="width: 400px;">
            </div>
        </div>


        <div class="am-form-group am-cf">

            <div class="zuo">任务单量：</div>
            <div class="zuo">
                <input type="text" name="number" class="myinput am-input-sm" id="" placeholder="请输入任务单量">
            </div>
            <div class="zuo type_h_num"
                 style="width: 240px"><?php echo "(DSR 一个链接只能做6单)" ?></div>

            <div class="zuo">每单数量：</div>
            <div class="zuo">
                <input type="text" name="each_single" class="myinput am-input-sm" id="doc-ipt-email-1"
                       placeholder="请输入每单数量">
            </div>
        </div>

        <div class="am-form-group am-cf showpicbox pcibox" style="display: none">

            <div class="zuo">晒图上传：</div>
            <div class="zuo upbtn" style="height: 45px; width: 250px">
                <a href="javascript:" class="file" style="left: -20px ;bottom: 0">上传压缩包（每单1金币服务费）
                    <input type="file" name="uploadFile" class="uploadPicButton2" id="upload_file2">
                </a>
            </div>
            <div class="zuo cannal" style="height: 45px; width: 100px;display: none">
                <div class=" am-btn-secondary am-radius" style="text-align: center">取消晒图</div>
            </div>
            <div class="zuo showpicnum" style="color: red;width:auto;">请将图片打包上传(仅支持rar,zip格式 最大20m
                所有图片放在一个文件夹下,每单限1张晒图)
            </div>
        </div>

        <div class="am-form-group am-cf showpicbox showtxetbox" style="display: none">

            <div class="zuo">指定评论：</div>
            <div class="zuo upbtn" style="height: 45px; width: 250px">
                <a href="javascript:" class="file" style="left: -20px ;bottom: 0">请上传评论（每单1金币服务费）
                    <input type="file" name="uploadFile" class="uploadPicButton3" id="upload_file3">
                </a>
            </div>
            <div class="zuo cannal" style="height: 45px; width: 100px;display: none">
                <div class=" am-btn-secondary am-radius" style="text-align: center">取消指定评论</div>
            </div>

            <div class="zuo textnum" style="color: red;width:auto;">请将评论以文档格式上传评论数量对应单量（每行文字算一条评论，每条评论请写成一行），仅支持txt格式
            </div>
        </div>


        <div class="am-form-group am-cf">
            <div class="zuo">购买类型选择：</div>
            <div class="zuo" style="width: auto">
                <label class="am-radio-inline">
                    <input type="radio" value="1" name="pay_type"> 全部开团
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="2" name="pay_type"> 单独购买
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="3" name="pay_type"> 优先参团
                </label>
            </div>
            <div class="zuo">定时发布(最早限明日)：</div>
            <div class="zuo" style="width: 350px">
                <input type="text" name="timing" class="myinput am-input-sm datapick1" style="width: 180px"
                       id="doc-ipt-email-1" placeholder="定时发布时间">
            </div>
        </div>


        <div class="am-form-group am-cf gexing">
            <div class="zuo">账户选择：</div>
            <div class="zuo" style="width: auto">
                <label class="am-radio-inline">
                    <input type="radio" value="0" name="sex" checked>男女随意(免费)
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="1" name="sex"> 男号(1金币)
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="2" name="sex"> 女号(1金币)
                </label>
            </div>


        </div>
        <div class="am-form-group am-cf gexing">
            <div class="zuo">个性设置：</div>
            <div class="zuo" style="width: 620px">
                <div class="zuo" style="width: 720px;margin-top:6px">
                    <label class="am-checkbox-inline">
                        <input type="checkbox" name="chat">假聊(2金币)
                    </label>
                    <label class="am-checkbox-inline">
                        <input type="checkbox" name="compare">货比三家(1金币)
                    </label>
                    <label class="am-checkbox-inline">
                        <input type="checkbox" name="collection">收藏商品店铺(2金币)
                    </label>
                    <label class="am-checkbox-inline ">
                        <input type="checkbox" name="sign">签收(1金币)
                    </label>
                    <label class="am-checkbox-inline ">
                        <input type="checkbox" name="dianzan">评论点赞(0.5金币)
                    </label>

                    <label class="am-checkbox-inline hostlog" style="display: none">
                        <input type="checkbox" name="overnight">隔夜收藏(2金币)

                    </label>
                </div>
            </div>

            <div class="zuo"
                 style="width:180px;margin-bottom: 0px;height: 40px;line-height: 40px;margin-left: 30px;display: none">
                凌晨单(至少提前4小时)
            </div>
            <div class="zuo2" >
                <label class="am-checkbox">
                    <input type="checkbox" name="night">
                    选择(2金币)
                </label>
            </div>
        </div>

        <div class="am-form-group am-cf daifabox">

            <div class="zuo">物流代发</div>
            <div class="zuo2" style="margin-top: 4px;width: 200px">
                <label class="am-radio-inline">
                    <input type="radio" value="0" checked name="daifa">不代发
                </label>
                <label class="am-radio-inline">
                    <input type="radio" value="1" name="daifa"> 代发(1.1金币)
                </label>
            </div>


        </div>
        <div class="am-form-group am-cf">
            <div class="zuo">备注说明：</div>
            <div class="you">
                <input type="text" name="remarks" class="myinput am-input-sm" id="doc-ipt-email-1" placeholder="请输入备注">
            </div>
        </div>
        <div class="am-form-group am-cf">
            <div class="zuo">SKU：</div>
            <div class="you">
                <input type="text" name="sku" class="myinput am-input-sm" id="doc-ipt-email-1" placeholder="请输入备注">
            </div>
        </div>
        <div class="am-form-group am-cf">
            <div class="zuo">主图上传：</div>
            <div class="you" style="height: 45px;">
                <div class="picbox" style="">
                    <img src="<?php echo base_url(); ?>/public/assets/image/wsc.png" class="picshow" style=" ">
                </div>
                <a href="javascript:" class="file">上传图片
                    <input type="file" name="uploadFile" class="uploadPicButton" id="upload_file">
                </a>
            </div>
        </div>
        <div class="am-form-group am-cf  taskbottom" style="">
            <div class="moneybox" style=" ">
                <div class="zuo" style="">任务所需本金：<span class="needmoney red">0</span></div>
                <div class="zuo" style="margin-left: 25px;">任务所需金币： 基础佣金:<span class="needgold red"
                                                                               style="margin-left: 5px">0</span>
                    服务费:<span class="needgold2 red" style="margin-left: 5px">0</span></div>

                <div id="fabu" class=" submit am-btn am-btn-secondary am-radius" style="margin-right: 0px;">发布任务</div>

            </div>
        </div>
    </form>


    <div class="" style="display: none">
        <div class="pay-content">
            <div class="typehbox">
                <div class="tbox" key="0"> 普通单</div>
                <div class="tbox" key="1"> 高留评</div>
                <div class="tbox" key="2"> 搜索指数+DSR单</div>
                <div class="tbox" key="3"> 拼多多直播</div>
            </div>
        </div>

    </div>


    <script>
        var shoplist = '<?php echo json_encode($shoplist); ?>';
        var webid = '<?php echo $this->web_id; ?>';
        if (webid == '26') {
            $(".daifabox").hide();
        }
        shoplist = JSON.parse(shoplist);

        if (shoplist.length > 0) {

        }

        var paycontent = layer.open({
            type: 1,
            title: '请选择任务类型',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '230px'], //宽高
            content: $(".pay-content").html()
        });


        function getRequest(urlStr) {
            if (typeof urlStr == "undefined") {
                var url = decodeURI(location.search); //获取url中"?"符后的字符串
            } else {
                var url = "?" + urlStr.split("?")[1];
            }
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                let strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        };
        var taskinfo = {};
        if (localStorage['taskinfo']) {
            taskinfo = JSON.parse(localStorage['taskinfo']);
        }

        function settaskinfo() {
            localStorage['taskinfo'] = JSON.stringify(taskinfo);
        }


        $("input").change(function (i, v) {
            let name = $(this).attr("name");
            taskinfo[name] = $(this).val();

            let type = $(this).attr("type");
            if (type == 'checkbox') {
                return
            }
            settaskinfo();
        });

        $("input[type='checkbox']").change(function (i, v) {
            let name = $(this).attr("name");
            taskinfo[name] = $("input[name='" + name + "']:checked").length
            settaskinfo();
        });

        $(".shop_name").change(function (i, v) {
            taskinfo['shop_name'] = $(this).val();
            settaskinfo();
        });
        if (taskinfo['shop_name']) {
            $(".shop_name").val(taskinfo['shop_name'])
        }
        if (!taskinfo.type_h) {
            $("input[name='type_h']").get(0).click();
        }


        $(".tbox").click(function () {
            let key = $(this).attr("key");
            key = key * 1;
            $("input[name='type_h']").get(key).click();
            layer.close(paycontent);
        });


        var minnub = "<?php echo $min; ?>";
        var goods_id = "";

        minnub = 10;
        var maxnub = "<?php echo $max; ?>";
        var is12 = "<?php echo $is12; ?>"; //确认现在是否是12点
        var ishostweb = "<?php echo $this->web_id == 1 ? 1 : 0; ?>";
        var showpicnum = 0; //高留评的
        var showpicpath = "";
        var textpath = "";
        var textnum = "";
        var picurl = "";
        var picpath = "";


        if (taskinfo) {
            $.each(taskinfo, function (i, v) {

                if (i == "") {
                    return;
                }
                if (i == "showpicpath") {
                    showpicpath = v;
                    return
                }
                if (i == "showpicnum") {
                    showpicnum = v;
                    $(".showpicnum").text("成功上传" + showpicnum + "张图片");
                    $(".pcibox .cannal").show();
                    $(".pcibox .upbtn").hide();
                    return
                }

                if (i == "textpath") {
                    textpath = v;
                    return
                }
                if (i == "textnum") {
                    textnum = v;
                    $(".textnum").text("成功上传" + textnum + "条评论");
                    $(".showtxetbox .cannal").show();
                    $(".showtxetbox .upbtn").hide();
                    return
                }
                if (i == "picurl") {
                    picurl = v;
                    $(".picshow").attr("src", picurl);
                    $(".picshow").addClass("newpic");
                    return
                }
                if (i == "picpath") {
                    picpath = v;
                    return
                }

                let type = $("input[name=" + i + "]").attr("type");
                if (type == "text") {
                    $("input[name=" + i + "]").val(v)
                }
                if (type == "radio") {
                    $.each($("input[name=" + i + "]"), function (i2, v2) {
                        let value = $(this).val();
                        if (value == v) {
                            $(this).click();
                        }

                    })
                }

                if (type == "checkbox") {

                    if (v == 1) {
                        $("input[name=" + i + "]").attr("checked", "true")
                    }

                }
            })
            setgold();
        }


        if (ishostweb == "0") {
            $(".hostlog").hide()
        }
        var on_request = false;
        var type = 1;
        var page = 1;
        $("input").attr("autocomplete", "off");
        $("input[name='number']").focus(function () {
            $(this).val("");
        });
        $("input[name='each_single']").focus(function () {
            $(this).val("");
        });


        $(".uploadPicButton").change(function () {
            var pic = $('#upload_file')[0].files[0];
            var fd = new FormData();
            fd.append('uploadFile', pic);
            var url = "<?php echo base_url(); ?>/Business/uppic";

            $.ajax({
                url: url,
                type: "post",
                dataType: "json",
                // Form数据
                data: fd,
                cache: false,
                contentType: false,
                processData: false,
                success: function (data) {
                    if (data.code == 0) {
                        $(".picshow").attr("src", data.url);
                        $(".picshow").addClass("newpic");

                        $(".picshow").show();
                        $("input[name=pic]").val(data.url);
                        picpath = data.path;
                        taskinfo.picpath = picpath;
                        taskinfo.picurl = data.url;
                        settaskinfo();
                        return;
                    }
                    layer.msg(data.msg);
                }
            });
        });

        $(".uploadPicButton2").change(function () {
            var pic = $('#upload_file2')[0].files[0];
            var fd = new FormData();
            fd.append('uploadFile', pic);
            var url = "<?php echo base_url(); ?>/Business/uprar";
            showpicnum = 0;
            showpicpath = "";
            $(".showpicnum").text("图片上传中请耐心等待……(上传超过1分钟请刷新重试)");
            // $("input[name='number']").attr("readonly","false");
            on_request = true;
            $.ajax({
                url: url,
                type: "post",
                dataType: "json",
                // Form数据
                data: fd,
                cache: false,
                contentType: false,
                processData: false,
                success: function (data) {
                    on_request = false;
                    if (data.code == 0) {
                        showpicnum = data.num;
                        showpicpath = data.path;
                        taskinfo.showpicnum = showpicnum;
                        taskinfo.showpicpath = showpicpath;
                        settaskinfo();
                        $(".showpicnum").text("成功上传" + showpicnum + "张图片");
                        $(".showpicnum").show();
                        $("input[name='number']").val(showpicnum);
                        setgold();
                        $(".showpicbox .upbtn").hide();
                        $(".showpicbox .cannal").show();
                        // $("input[name='number']").attr("readonly","true");
                    } else {
                        delete taskinfo.showpicnum;
                        delete taskinfo.showpicpath;
                        showpicnum = 0;
                        window.location.reload()
                        showpicpath = "";
                        settaskinfo();
                        $(".showpicnum").text("请将图片打包上传(仅支持rar,zip格式 最大20m 所有图片放在一个文件夹下,每单限1张晒图)");
                    }
                    layer.msg(data.msg);
                }
            });
        });

        $(".uploadPicButton3").change(function () {
            var pic = $('#upload_file3')[0].files[0];
            var fd = new FormData();
            fd.append('uploadFile', pic);
            var url = "<?php echo base_url(); ?>/Business/uptext";
            textnum = 0;
            textpath = "";
            $(".showtextnum").text("(评论上传中请耐心等待，上传超过1分钟请刷新重试)");
            // $("input[name='number']").attr("readonly","false");
            on_request = true;
            $.ajax({
                url: url,
                type: "post",
                dataType: "json",
                // Form数据
                data: fd,
                cache: false,
                contentType: false,
                processData: false,
                success: function (data) {
                    on_request = false;
                    if (data.code == 0) {
                        textnum = data.num;
                        textpath = data.path;
                        taskinfo.textnum = textnum;
                        taskinfo.textpath = textpath;
                        settaskinfo();
                        $(".textnum").text("成功上传" + textnum + "条评论");
                        $(".textnum").show();
                        $("input[name='number']").val(textnum);
                        setgold();
                        $(".showtxetbox .upbtn").hide();
                        $(".showtxetbox .cannal").show();
                        // $("input[name='number']").attr("readonly","true");
                    } else {
                        delete taskinfo.textnum;
                        delete taskinfo.textpath;
                        textnum = 0;
                        window.location.reload()
                        textpath = "";
                        settaskinfo();
                        $(".textnum").text("(评论上传中请耐心等待，上传超过1分钟请刷新重试)");
                    }
                    layer.msg(data.msg);
                }
            });
        });


        $(".pcibox .cannal").click(function () {
            layer.confirm('确认取消晒图！', {
                btn: ['确认', '取消'] //按钮
            }, function () {
                delete taskinfo.showpicnum;
                delete taskinfo.showpicpath;
                showpicnum = 0;
                window.location.reload()
                showpicpath = "";
                settaskinfo();
                $(".showpicnum").text("请将图片打包上传(仅支持rar,zip格式 最大20m 所有图片放在一个文件夹下,每单限1张晒图)");
            }, function () {

            });
        });

        $(".showtxetbox .cannal").click(function () {
            layer.confirm('确认取消指定评论！', {
                btn: ['确认', '取消'] //按钮
            }, function () {
                delete taskinfo.textnum;
                delete taskinfo.textpath;
                textnum = 0;
                window.location.reload()
                textpath = "";
                settaskinfo();
                $(".textnum").text("(评论上传中请耐心等待，上传超过1分钟请刷新重试)");
            }, function () {

            });
        });


        $("#fabu").click(function () {
            fabu();
        });
        $("input[name='price']").change(function () {
            var value = $(this).val();
            $("input[name='pay_price']").val(value);
            $("input[name='single_price']").val(value);
            $("input[name='group_price']").val(value);
        });

        $("input[name='link']").change(function () {
            var value = $(this).val();
            const match = value.match(/yangkeduo.com.*?goods_id=(\d{7,13})/i); // "Hello"
            if (!match) {
                //layer.msg("链接错误");
                return;
            }
            goods_id = match[1];
            taskinfo['goods_id'] = goods_id;

        });

        function fabu() {
            if (on_request) {
                return;
            }
            var url = "<?php echo base_url(); ?>/Business/SendPddTask";
            var postdata = {};
            var link = $("input[name='link']").val();
            var goods_name = $("input[name='goods_name']").val();
            var shop_name = $("input[name='shop_name']").val();

            shop_name = $(".shop_name").val();
            if (!shop_name) {
                layer.msg("缺少商铺名称");
                return;
            }


            var price = $("input[name='price']").val();
            var pay_price = $("input[name='pay_price']").val();

            var number = $("input[name='number']").val();
            var each_single = $("input[name='each_single']").val();
            var keyword = $("input[name='keyword']").val();
            //  var coupon=$("input[name='coupon']").val();
            var sku = $("input[name='sku']").val();
            var remarks = $("input[name='remarks']").val();
            var pay_type = $("input[name='pay_type']:checked").val();
            var type_h = $("input[name='type_h']:checked").val();


            var single_price = pay_price;
            var group_price = pay_price;


            let chat = $("input[name='chat']:checked").val();
            let compare = $("input[name='compare']:checked").val();
            let collection = $("input[name='collection']:checked").val();
            let sign = $("input[name='sign']:checked").val();
            let overnight = $("input[name='overnight']:checked").val();
            let night = $("input[name='night']:checked").val();
            let dianzan = $("input[name='dianzan']:checked").val();

            let sex = $("input[name='sex']:checked").val();

            let daifa = $("input[name='daifa']:checked").val();

            if (type_h == 3) {
                daifa = '0';
            }


            postdata['daifa'] = daifa;
            postdata['link'] = link;
            postdata['goods_name'] = goods_name;
            postdata['shop_name'] = shop_name;
            postdata['price'] = price;
            postdata['pay_price'] = pay_price;
            postdata['number'] = number;
            postdata['each_single'] = each_single;
            postdata['keyword'] = keyword;
            //  postdata['coupon'] = coupon;
            postdata['sku'] = sku;
            postdata['remarks'] = remarks;
            postdata['pay_type'] = pay_type;
            postdata['single_price'] = pay_price ? single_price : pay_price;
            postdata['group_price'] = pay_price ? group_price : pay_price;
            postdata['type_h'] = type_h;


            if (type_h == 1) {
                postdata['chat'] = chat ? 1 : 0;
                postdata['compare'] = compare ? 1 : 0;
                postdata['collection'] = collection ? 1 : 0;
                postdata['sign'] = sign ? 1 : 0;
                postdata['overnight'] = overnight ? 1 : 0;
                postdata['sex'] = sex;
                postdata['night'] = night ? 1 : 0;
                postdata['dianzan'] = dianzan ? 1 : 0;

            }


            postdata['releasetime'] = $(".datapick1").val();
            if (!postdata['releasetime'] && postdata['night']) {
                layer.msg("凌晨单只能提前定时发布");
                return;
            }


            /*
                        if(type_h==2){
                            layer.msg("暂时关闭高留评订单");
                            return;
                        }*/

            if (is12 == "1" && type_h == 2) {
                layer.msg("超过18点不能发布高留评单");
                return;
            }
            if (type_h == 2 && (number * 1 > showpicnum * 1) && showpicpath != "") {
                layer.msg("单量大于上传的晒图数量");
                return;
            }
            if (type_h == 3 && (number != 6)) {
                layer.msg("DSR单量必须是6单");
                return;
            }

            if (type_h == 2 && link == "") {
                layer.msg("缺少商品ID");
                return;
            }
            if (type_h == 2) {
                /*  if(isNaN(link)){
                      let itemid= getRequest(link);
                      link=itemid.gid;
                  }*/
                let res = checknum(link, 'link');
            }
            if (pay_type == undefined) {
                layer.msg("缺少开团信息");
                return;
            }
            if (type_h == undefined) {
                layer.msg("缺少订单类型");
                return;
            }
            if (type_h == 2 && showpicpath != "") {
                postdata['showpicpath'] = showpicpath
            }
            if (type_h == 2 && textnum != "") {
                postdata['textpath'] = textpath
                postdata['textnum'] = textnum
            }
            let keylist = ['coupon', 'remarks', 'keyword', 'sku', 'releasetime', 'chat', 'compare', 'collection', 'sign', 'overnight', 'sex', 'dianzan', 'night']//这些参数不需必传


            var alldata = 1;
            var valuekey = "";
            $.each(postdata, function (key, value) {
                if ((!value) && $.inArray(key, keylist) == -1) {

                    alldata = 0;
                    valuekey = key;

                    return false;
                }
            });
            if (!alldata) {
                layer.msg("缺少参数" + valuekey, {icon: 5, time: 800});
                $("input[name='" + valuekey + "']").focus();
                on_request = false;
                return;
            }

            checknum(number, 'number');
            checknum(price, 'price');
            checknum(pay_price, 'pay_price');
            checknum(each_single, 'each_single');
            checknum(single_price, 'single_price');
            checknum(group_price, 'group_price');

            if (number > 10 && type_h == 1) {
                var result = confirm("单量超过10 请确认是否正确");
                if (!result) {
                    return;
                }
            }
            if (number * 1 < minnub * 1 && type_h == 2) {
                layer.msg("高留评单单量必须在10-200之间", {icon: 5, time: 800});
                return;
            }
            if (each_single * 1 < 2 && type_h == 2) {
                layer.msg("高留评单每单数量2件起拍", {icon: 5, time: 800});
                return;
            }
            if (number * 1 > maxnub * 1 && type_h == 2) {
                layer.msg("高留评单单量必须在10-200之间", {icon: 5, time: 800});
                return;
            }
            if (each_single > 10 && type_h == 1) {
                var result = confirm("单量超过10 请确认是否正确");
                if (!result) {
                    return;
                }
            }
            postdata['pic'] = picpath;


            on_request = true;
            $.post(url, postdata, function (data) {
                on_request = false;
                if (data.code == 0) {
                    layer.msg("任务发布成功");
                    localStorage['taskinfo'] = "";
                    window.location.href = "<?php echo base_url() ?>" + '/business/pddtasklist';
                } else {
                    layer.msg(data.msg)
                }
            }, "json");
        }

        $("#updata").click(function () {
            console.log(taskinfo['goods_id']);
            if (!taskinfo['goods_id']) {
                return
            }
            let url = 'https://pifa.pinduoduo.com/goods/detail/?gid=' + taskinfo['goods_id'];

            window.open(url);
        });

        $("input[name='each_single']").bind("change", setgold);
        $("input[name='pay_price']").bind("change", setgold);
        $("input[name='number']").bind("change", setgold);
        $("input[name='price']").bind("change", setgold);
        $("input[name='type_h']").bind("change", setgold);
        $("input[name='daifa']").bind("change", setgold);

        $("input[name='chat']").bind("change", setgold);
        $("input[name='compare']").bind("change", setgold);
        $("input[name='collection']").bind("change", setgold);
        $("input[name='sign']").bind("change", setgold);
        $("input[name='overnight']").bind("change", setgold);
        $("input[name='sex']").bind("change", setgold);

        $("input[name='night']").bind("change", setgold);
        $("input[name='dianzan']").bind("change", setgold);


        function setgold() {
            on_request = false;
            var price = $("input[name='pay_price']").val();
            var number = $("input[name='number']").val();
            var each_single = $("input[name='each_single']").val();

            var type_h = $("input[name='type_h']:checked").val();


            if (type_h == 1) {
                $(".gexing").show()
            } else {
                $(".gexing").hide()
            }
            $("#updata").hide();
            if (type_h == 2) {
                $(".daifabox").show();
                $(".showpicbox").show();
                $(".itemid .zuo").text("商品ID：");
                $(".itemid input").attr("placeholder", "请输入你的商品的ID");
                $(".gaotext").show();
                $("#updata").show();
                $(".dsrtext").hide();
            } else {
                $(".gaotext").hide();
                $(".daifabox").show();
                $("#updata").hide();

                if (type_h == 3) {

                    $(".dsrtext").show();
                    $(".itemid .zuo").text("短链接：");
                    $(".itemid input").attr("placeholder", "请输入商品短链接")
                    $(".showpicbox").hide();
                    $(".daifabox").hide();

                } else {
                    $(".dsrtext").hide();
                    $(".itemid .zuo").text("商品链接：");
                    $(".itemid input").attr("placeholder", "请输入商品的链接")
                    $(".showpicbox").hide();

                }
            }

            let chat = $("input[name='chat']:checked").val();
            let compare = $("input[name='compare']:checked").val();
            let collection = $("input[name='collection']:checked").val();
            let sign = $("input[name='sign']:checked").val();
            let overnight = $("input[name='overnight']:checked").val();
            let sex = $("input[name='sex']:checked").val();
            let night = $("input[name='night']:checked").val();
            let dianzan = $("input[name='dianzan']:checked").val();
            let daifa = $("input[name='daifa']:checked").val();
            if (type_h == 3) {
                daifa = 0;
            }

            var needmoney = price * each_single;
            if (type_h == 2 &&each_single==2) {
                needmoney=price;
            }

            if (needmoney <= 0 || type_h == undefined) {
                $(".needgold").text(0);
                $(".needgold2").text(0);
                return;
            }

            $(".needmoney").text((price * each_single * number).toFixed(2));
            var url = "<?php echo base_url(); ?>/Business/getgoldbymoney/2/" + type_h;
            var postdata = {};
            needmoney = formatterNumber(needmoney);
            postdata['needmoney'] = needmoney;

            let base = 1;

            if (type_h == 1) {
                if (chat) {
                    base = base + 2;
                }
                if (compare) {
                    base = base + 1;
                }
                if (collection) {
                    base = base + 2;
                }
                if (sign) {
                    base = base + 1;
                }
                if (overnight) {
                    base = base + 2;
                }
                if (sex * 1 > 0) {
                    base = base + 1;
                }

                if (night) {
                    base = base + 2;
                }
                if (dianzan) {
                    base = base + 0.5;
                }
            }
            if (type_h == 2 && showpicnum * 1 > 0) {
                base = base + 1;
            }
            if (type_h == 2 && textnum * 1 > 0) {
                base = base + 1;
            }

            if (daifa * 1 > 0) {
                base = base + 1.1;
            }

            $.post(url, postdata, function (data) {
                on_request = false;
                number = number * 1;
                data.allgold = data.allgold * number;
                data.allgold = data.allgold - number;
                data.allgold = data.allgold.toFixed(1);
                $(".needgold").text(data.allgold);
                $(".needgold2").text((number * base).toFixed(1));
            }, "json");

        }


        laydate.render({
            elem: '.datapick1',
            type: 'datetime'
        });


    </script>













